﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using EbbinghausWord.BLL;
using Microsoft.Phone.Controls;

namespace EbbinghausWord.Pages
{
    public partial class StudyAchievementPage : PhoneApplicationPage
    {
        public StudyAchievementPage()
        {
            InitializeComponent();

        }


        #region private method

        /// <summary>
        /// 初始化待复习的单词
        /// </summary>
        private void InitReviewWords()
        {
            reviewWordListControl.WordList = ReviewManager.GetReviewWordBook();
        }

        /// <summary>
        /// 初始化记住的单词列表
        /// </summary>
        private void InitAchievement()
        {
            achievementWordListControl.WordList = WordBookManager.GetAchievementWords();
        }

        /// <summary>
        /// 初始化学习中的单词
        /// </summary>
        private void InitLearningWords()
        {
            learningWordListControl.WordList = WordBookManager.GetLearningWords();
        }

        #endregion

        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            progressOverlay.Visibility = Visibility.Visible;

            new Thread(() => this.Dispatcher.BeginInvoke(() =>
                                                             {
                                                                 InitReviewWords();
                                                                 InitAchievement();
                                                                 InitLearningWords();
                                                                 progressOverlay.Visibility = Visibility.Collapsed;
                                                             })).Start();



        }
    }
}